const Router = require('koa-router');
const router = new Router();
const tool = require('../../tools/tool')
const {db, QueryTypes} = require("../../models/db");

router.post('/role/saveRoleMenu', async ctx => {
    let formData = ctx.request.body.formData
    let roleId = ctx.request.body.roleId
    if(roleId) {
        await db.models['roleMenu'].destroy({
            where: {
                roleId: roleId
            }
        })
        await db.models['roleMenu'].bulkCreate(formData)
    }
    return ctx.suc('已保存')
})


module.exports = router;
